<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>员工管理系统 - 登录</title>
    <link rel="stylesheet" href="css/style.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="js/utils.js"></script>
    <script src="js/api.js"></script>
</head>
<body>
    <div class="login-container">
        <div class="login-header">
            <h2>员工管理系统</h2>
        </div>
        <div class="login-form">
            <div class="form-group">
                <label for="username">用户名</label>
                <input type="text" id="username" placeholder="请输入用户名">
            </div>
            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" id="password" placeholder="请输入密码">
            </div>
            <button id="login-btn" class="btn btn-primary">登录</button>
        </div>
    </div>

    <script>
        $(document).ready(function() {
            // 模拟登录功能
            $('#login-btn').click(function() {
                const username = $('#username').val();
                const password = $('#password').val();

                if (!validateLoginForm(username, password)) {
                    return;
                }

                // 模拟登录成功，存储token
                localStorage.setItem('token', 'fake_token_for_demo');
                localStorage.setItem('username', username);

                // 跳转到仪表盘
                window.location.href = 'dashboard.html';
            });

            function validateLoginForm(username, password) {
                if (!username || username.trim() === '') {
                    alert('请输入用户名');
                    return false;
                }
                if (!password || password.trim() === '') {
                    alert('请输入密码');
                    return false;
                }
                return true;
            }
        });
    </script>
</body>
</html>